package de.recipeminer.persistence;

import com.db4o.Db4oEmbedded;
import com.db4o.config.EmbeddedConfiguration;
import org.apache.log4j.Logger;

/**
 * @autor: Markus Ackermann
 */
public abstract class Db4oConfigurationProvider {
    private static Logger logger = Logger.getLogger(Db4oConfigurationProvider.class);

    public EmbeddedConfiguration getConfig(){
        EmbeddedConfiguration config = new Db4oEmbedded().newConfiguration();
        modifyConfig(config);
        return config;
    }

    protected abstract void modifyConfig(EmbeddedConfiguration config);


    public static class Default extends Db4oConfigurationProvider {
        public void modifyConfig(EmbeddedConfiguration config) {
            config.common().activationDepth(Integer.MAX_VALUE);
            config.common().updateDepth(Integer.MAX_VALUE);
        }
    }
}
